<?php /* @var $this Controller */ ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="language" content="en" />

    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->theme->baseUrl; ?>/css/styles.css" />

	<title><?php echo CHtml::encode($this->pageTitle); ?></title>

	<?php Yii::app()->bootstrap->register(); ?>
</head>

<body>

<?php $this->widget('bootstrap.widgets.TbNavbar',array(
	'type'=>'inverse',
	'items'=>array(
		array(
			'htmlOptions'=>array('style'=>'float:none;'),
			'encodeLabel' => false,
			'class'=>'bootstrap.widgets.TbMenu',
			'items'=>array(
				array(
					'label' => '<i class="icon-envelope icon-white"></i>' . ' ' . ((Credits::model()->count('user_id = :u AND status = :n', array(':u' => Yii::app()->user->id, ':n' => Credits::STATUS_NEW_SCORRING))) ?:''),
					'url' => Yii::app()->createUrl('credits/new'),
					'visible' => (Credits::model()->find('user_id = :u AND (status = :s OR status = :n)', array(':u' => Yii::app()->user->id, ':s' => Credits::STATUS_SCORRING, ':n' => Credits::STATUS_NEW_SCORRING))) !== null
				),
				array(
					'label'=>'Выход ('.Yii::app()->user->name.')',
					'url'=>Yii::app()->createUrl('site/logout'),
					'visible'=>!Yii::app()->user->isGuest,
					'itemOptions'=>array('style'=>'float:right;')
				),
				array(
					'label'=>'Сменить пароль',
					'url'=>Yii::app()->createUrl('users/changePassword'),
					'visible'=>(Yii::app()->user->getState('role')==Users::OPERATOR_ROLE or Yii::app()->user->getState('role')==Users::MANAGER_ROLE)?true:false,
					'itemOptions'=>array('style'=>'float:right;'),
					'linkOptions'=>array('id'=>'cp-modal')
				),
			),
		),
	),
)); ?>

<div class="container" id="page">

	<?php if(isset($this->breadcrumbs)):?>
		<?php $this->widget('bootstrap.widgets.TbBreadcrumbs', array(
		'links'=>$this->breadcrumbs,
	)); ?><!-- breadcrumbs -->
	<?php endif?>

	<?php echo $content; ?>

	<div class="clear"></div>

	<div id="footer"></div><!-- footer -->

</div><!-- page -->
</body>
</html>